package api

import (
	"iris-starter/pkg/errno"
	"iris-starter/service"

	"github.com/kataras/iris/v12"
)

type AdminUserController struct {
	Ctx     iris.Context
	Service service.IAdminUserService
}

func (c *AdminUserController) GetBy(id int64) {
	//id := c.Ctx.Params().GetInt64Default("id", 0)
	detail, err := c.Service.Detail(uint64(id))
	if err == nil && detail.ID > 0 {
		JsonResponse(c.Ctx, nil, detail)
	} else {
		JsonResponse(c.Ctx, errno.ErrModelNotFound, nil)
	}

}
